package ch.ffhs.bscinf2009.organizeanything.data;

import java.io.Serializable;

/**
 * @author lir
 * The abstract type defines the structure of available types which can be used while creating new type definitions
 */
public abstract class AbstractType implements Serializable {
	private static final long serialVersionUID = -5978141546051170284L;

	private String propertyName;

	private boolean descriptorValue;

	/**
	 * Returns the value which should be displayed on the GUI for the current type
	 * @return the display value
	 */
	public abstract String displayValue();
	/**
	 * Parses the type definition for the current type.
	 * @param definition the definition to parse
	 */
	public abstract void parseTypeDefinition(String definition);
	/**
	 * Parses the type definition values
	 * @return the type definition string
	 */
	public abstract String buildTypeDefinition();
	/**
	 * sets the data of the type during creation of an instance
	 * @param data the data to set
	 */
	public abstract void setData(String data);

	/**
	 * if the value should be shown on the instance list
	 * @return true if so
	 */
	public boolean isDescriptorValue() {
		return descriptorValue;
	}

	/**
	 * defines if the value should be shown on the instance list. usually true for the first type of a definition.
	 * @param descriptorValue true if so
	 */
	public void setDescriptorValue(boolean descriptorValue) {
		this.descriptorValue = descriptorValue;
	}
	
	/**
	 * sets the name of the property of the current type
	 * @param propertyName
	 */
	public void setPropertyName(String propertyName) {
		this.propertyName = propertyName;
	}
	
	/**
	 * retrieves the property name of the current type
	 * @return the property name
	 */
	public String getPropertyName() {
		return propertyName;
	}
	/**
	 * retrieves the data of the current type
	 * @return the data itself
	 */
	public abstract String getData();
	
}
